package com.facebook.common.util;

import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.MediaStore.Images.Media;
import javax.annotation.Nullable;

public class UriUtil
{
  public static final String DATA_SCHEME = "data";
  public static final String HTTPS_SCHEME = "https";
  public static final String HTTP_SCHEME = "http";
  public static final String LOCAL_ASSET_SCHEME = "asset";
  private static final String LOCAL_CONTACT_IMAGE_PREFIX = Uri.withAppendedPath(ContactsContract.AUTHORITY_URI, "display_photo").getPath();
  public static final String LOCAL_CONTENT_SCHEME = "content";
  public static final String LOCAL_FILE_SCHEME = "file";
  public static final String LOCAL_RESOURCE_SCHEME = "res";

  @Nullable
  public static String getRealPathFromUri(ContentResolver paramContentResolver, Uri paramUri)
  {
    Cursor localCursor;
    if (isLocalContentUri(paramUri))
      localCursor = null;
    boolean bool1;
    do
    {
      try
      {
        localCursor = paramContentResolver.query(paramUri, null, null, null, null);
        localObject1 = null;
        if (localCursor != null)
        {
          boolean bool2 = localCursor.moveToFirst();
          localObject1 = null;
          if (bool2)
          {
            int i = localCursor.getColumnIndex("_data");
            localObject1 = null;
            if (i != -1)
            {
              String str = localCursor.getString(i);
              localObject1 = str;
            }
          }
        }
        return localObject1;
      }
      finally
      {
        if (localCursor != null)
          localCursor.close();
      }
      bool1 = isLocalFileUri(paramUri);
      Object localObject1 = null;
    }
    while (!bool1);
    return paramUri.getPath();
  }

  @Nullable
  public static String getSchemeOrNull(@Nullable Uri paramUri)
  {
    if (paramUri == null)
      return null;
    return paramUri.getScheme();
  }

  public static boolean isDataUri(@Nullable Uri paramUri)
  {
    return "data".equals(getSchemeOrNull(paramUri));
  }

  public static boolean isLocalAssetUri(@Nullable Uri paramUri)
  {
    return "asset".equals(getSchemeOrNull(paramUri));
  }

  public static boolean isLocalCameraUri(Uri paramUri)
  {
    String str = paramUri.toString();
    return (str.startsWith(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())) || (str.startsWith(MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString()));
  }

  public static boolean isLocalContactUri(Uri paramUri)
  {
    return (isLocalContentUri(paramUri)) && ("com.android.contacts".equals(paramUri.getAuthority())) && (!paramUri.getPath().startsWith(LOCAL_CONTACT_IMAGE_PREFIX));
  }

  public static boolean isLocalContentUri(@Nullable Uri paramUri)
  {
    return "content".equals(getSchemeOrNull(paramUri));
  }

  public static boolean isLocalFileUri(@Nullable Uri paramUri)
  {
    return "file".equals(getSchemeOrNull(paramUri));
  }

  public static boolean isLocalResourceUri(@Nullable Uri paramUri)
  {
    return "res".equals(getSchemeOrNull(paramUri));
  }

  public static boolean isNetworkUri(@Nullable Uri paramUri)
  {
    String str = getSchemeOrNull(paramUri);
    return ("https".equals(str)) || ("http".equals(str));
  }

  public static Uri parseUriOrNull(@Nullable String paramString)
  {
    if (paramString != null)
      return Uri.parse(paramString);
    return null;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.facebook.common.util.UriUtil
 * JD-Core Version:    0.6.2
 */